<!DOCTYPE html>
<!-- 加上 xmlns:th="http://www.thymeleaf.org" -->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>修改会员</title>
    <link rel="stylesheet" href="/res/css/global.css">
    <link rel="stylesheet" href="/res/css/main.css">
    <link rel="stylesheet" href="/res/css/find_customer.css">
    <link rel="stylesheet" href="/res/font-awesome-4.7.0/css/font-awesome.css">
</head>
<body>
<!-- 外部容器 -->
<div id="container">


    <!-- 左边的导航 -->
    <div id="nav-list" class="left">
        <h2>
            <span></span>
            &nbsp;&nbsp;
            <span></span>
            &nbsp;&nbsp;
            <a href="/emp/logout">退出</a>
        </h2>
        <ul>
            <li><a href="/main">主页</a></li>
            <li><a href="/customer/select_customer">会员管理</a></li>
            <li><a href="/emp/selectEmp">员工管理</a></li>
            <li><a href="#">二手车管理</a></li>
            <li><a href="#">门店管理</a></li>
            <li><a href="/system/main">系统设置</a></li>
        </ul>
    </div>

    <!-- 右边的div -->
    <div id="main-div" class="right">
        <h2>修改会员</h2>
        <!-- 文件上传   enctype="multipart/form-data" -->
        <form action="/customer/update_customer" method="post" enctype="multipart/form-data">
            <!-- 隐藏域 id -->
            <input type="hidden" name="id" th:value="${customer.id}"/>
            <table>
                <tr>
                    <td>会员名：</td>
                    <td>
                        <span th:text="${customer.cusName}"></span>
                    </td>
                </tr>
                <tr>
                    <td>性别：</td>
                    <td>
                        <input type="radio" name="sex" value="男" th:field="*{customer.sex}"/>男
                        &nbsp;&nbsp;
                        <input type="radio" name="sex" value="女" th:field="*{customer.sex}"/>女
                    </td>
                </tr>
                <tr>
                    <td>生日：</td>
                    <td>
                        <input type="date" name="birthday" th:value="${#dates.format(customer.birthday,'yyyy-MM-dd')}"/>
                    </td>
                </tr>
                <tr>
                    <td>地址：</td>
                    <td>
                        <input type="text" name="address" th:value="${customer.address}"/>
                    </td>
                </tr>
                <tr>
                    <td>电话：</td>
                    <td>
                        <input type="text" name="phone" th:value="${customer.phone}">
                    </td>
                </tr>
                <tr>
                    <td>押金：</td>
                    <td>
                        <input type="text" name="yajin" th:value="${customer.yajin}">
                    </td>
                </tr>
                <tr>
                    <td>图片：</td>
                    <td>
                        <input type="file" name="head_img" id="head_img">
                        <img th:src="${'/res/images/upload/'+customer.pic}"
                             width="80px" height="80px" id="upload_head_img">
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td>
                        <input type="submit" th:value=" 修改会员 "/>
                    </td>
                </tr>
            </table>
        </form>
    </div>

</div>




<script type="text/javascript" src="/res/jquery/jquery.js"></script>
<!-- th:inline="javascript" -->
<script type="text/javascript" th:inline="javascript">

    // 选择上传图片，显示图片
    $("#head_img").change(function(){
        var file = document.getElementById("head_img");

        var imgUrl = window.URL.createObjectURL(file.files[0]);

        $("#upload_head_img").prop("src",imgUrl);
    });


</script>

</body>
</html>